package com.hospital.frontdesk.fronxiang.service.impl;

import com.github.pagehelper.PageHelper;
import com.hospital.frontdesk.fronxiang.dao.ConsumeinfosMapper;
import com.hospital.frontdesk.fronxiang.entity.Consumeinfos;
import com.hospital.frontdesk.fronxiang.service.ConsumeinfosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description：缴费记录业务实现类
 * @author：xyj
 * @date：2021/9/15 16:57
 * @versions：v1.0
 */
@Service
public class ConsumeinfosServiceimpl implements ConsumeinfosService {
    @Autowired
    private ConsumeinfosMapper consumeinfosMapper;

    /**
     * 分页查询缴费记录表
     *
     * @param name     姓名
     * @param pageNo   当前页码
     * @param pageSize 查询条数
     * @return
     */
    @Override
    public List<Consumeinfos> pageconsume(String name, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<Consumeinfos> pageconsume = consumeinfosMapper.pageconsume(name);
        return pageconsume;
    }

    @Override
    public boolean transfer(String xiangxi, Integer patientId) {
        Map<String, Object> map = new HashMap<>();
        map.put("xiangxi", xiangxi);
        map.put("patientId", patientId);
        Integer transfer = consumeinfosMapper.transfer(map);
        if (transfer == 1)
            return true;
        return false;
    }

}
